package com.xq.jltx.learnopenglandroidpro;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

import com.xq.jltx.learnopenglandroidpro.tutorial.lesson1.TutorialLessonOneActivity;
import com.xq.jltx.learnopenglandroidpro.tutorial.lesson2.TutorialLessonTwoActivity;
import com.xq.jltx.learnopenglandroidpro.tutorial.lesson3.TutorialLessonThreeActivity;
import com.xq.jltx.learnopenglandroidpro.tutorial.lesson4.TutorialLessonFourActivity;
import com.xq.jltx.learnopenglandroidpro.tutorial.lesson5.TutorialLessonFiveActivity;

public class MainActivity extends AppCompatActivity {
    private Button btn1;
    private Button btn2;
    private Button btn3;
    private Button btn4;
    private Button btn5;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        btn1 = findViewById(R.id.btn1);
        btn2 = findViewById(R.id.btn2);
        btn3 = findViewById(R.id.btn3);
        btn4 = findViewById(R.id.btn4);
        btn5 = findViewById(R.id.btn5);
        btn1.setOnClickListener(onClickListener);
        btn2.setOnClickListener(onClickListener);
        btn3.setOnClickListener(onClickListener);
        btn4.setOnClickListener(onClickListener);
        btn5.setOnClickListener(onClickListener);
    }


    private View.OnClickListener onClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent;
            switch (v.getId()) {
                case R.id.btn1:
                    intent = new Intent(MainActivity.this, TutorialLessonOneActivity.class);
                    MainActivity.this.startActivity(intent);
                    break;
                case R.id.btn2:
                    intent = new Intent(MainActivity.this, TutorialLessonTwoActivity.class);
                    MainActivity.this.startActivity(intent);
                    break;
                case R.id.btn3:
                    intent = new Intent(MainActivity.this, TutorialLessonThreeActivity.class);
                    MainActivity.this.startActivity(intent);
                    break;
                case R.id.btn4:
                    intent = new Intent(MainActivity.this, TutorialLessonFourActivity.class);
                    MainActivity.this.startActivity(intent);
                    break;
                case R.id.btn5:
                    intent = new Intent(MainActivity.this,TutorialLessonFiveActivity.class);
                    MainActivity.this.startActivity(intent);
                    break;
                default:
                    break;
            }
        }
    };


}
